import request from "@/utils/request";
import ConstTable from './ConstTable'


const api = {
    // 根据ID获取类型
    getInfo(id)
    {
        return request({
            url: `${ConstTable.BaseUrl}/BaseData/CustomerType/${id}`,
            method: "get"
        });
    },
    // 查询类型信息
    getList(query)
    {
        return request({
            url: `${ConstTable.BaseUrl}/BaseData/CustomerType`,
            method: "GET",
            data: query
        });
    },
    // 创建类型
    create(dataForm)
    {
        return request({
            url: `${ConstTable.BaseUrl}/BaseData/CustomerType`,
            method: "post",
            data: dataForm
        });
    },
    // 更新类型
    update(dataForm)
    {
        return request({
            url: `${ConstTable.BaseUrl}/BaseData/CustomerType/${dataForm.id}`,
            method: "PUT",
            data: dataForm
        });
    },
    // 删除类型
    delete(id)
    {
        return request({
            url: `${ConstTable.BaseUrl}/BaseData/CustomerType/${id}`,
            method: "DELETE"
        });
    },
    // 根据ID批量删除类型
    batchDelete(ids)
    {
        return request({
            url: `${ConstTable.BaseUrl}/BaseData/CustomerType/batchRemove`,
            method: "POST",
            data: ids
        });
    },
    // 根据查询条件导出数据
    export(query)
    {
        return request({
            url: `${ConstTable.BaseUrl}/BaseData/CustomerType/Actions/Export`,
            method: "GET",
            data: query
        });
    },
    // 导入
    ImportData(data)
    {
        return request({
            url: `${ConstTable.BaseUrl}/BaseData/CustomerType/ImportData`,
            method: "post",
            data
        });
    },
    // 导入预览
    ImportPreview(data)
    {
        return request({
            url: `${ConstTable.BaseUrl}/BaseData/CustomerType/ImportPreview`,
            method: "get",
            data
        });
    },
    // 模板下载
    TemplateDownload()
    {
        return request({
            url: `${ConstTable.BaseUrl}/BaseData/CustomerType/TemplateDownload`,
            method: "get"
        });
    }
};

export default api;

export const getDefactAll = api.getAll;
